package drds.binlog.event;

import drds.binlog.LogByteBlock;


public class RowsQueryLogEvent extends IgnorableLogEvent
{

    private String rowsQuery;

    public RowsQueryLogEvent(LogHeader logHeader, LogByteBlock logByteBlock, FormatDescriptionLogEvent formatDescriptionLogEvent)
    {
        super(logHeader, logByteBlock, formatDescriptionLogEvent);

        final int commonHeaderLength = formatDescriptionLogEvent.commonHeaderLength;
        final int postHeaderLength = formatDescriptionLogEvent.postHeaderLengths[logHeader.type - 1];

        /*
         * m_rows_query length is stored using only one byte, but that length is
         * ignored and the complete query is read.
         */
        int offset = commonHeaderLength + postHeaderLength + 1;
        int len = logByteBlock.limit() - offset;
        rowsQuery = logByteBlock.getFullString(offset, len, LogByteBlock.ISO_8859_1);
    }

    public String getRowsQuery()
    {
        return rowsQuery;
    }

}
